package com.molyfun.parents.rest.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.molyfun.parents.activity.coursecenter.model.SubjectListResponse;
import com.molyfun.parents.rest.BaseResponse;

import java.util.List;

/**
 * Created by william(liuchao.hit@gmail.com).
 * Date:10/21/16.
 */
public class OrderDetailResponse extends BaseResponse{

    private OrderBean data;

    public OrderBean getData(){
        return data;
    }

    public static class OrderBean implements Parcelable {

        /**
         * id : 4c93cfd80a254d86b0248d4e1d747d12
         * studentid : 8a2d9263570d9ee601573aeef0590498
         * status : init 待付款 pass 已付款 refundapply 退款申请 refund 已退款
         * statusname : null
         * amount : 0.01
         * createdatetime : 1488801299101
         * productList : [{"id":"9739c8364e7240f38047d9f002b27e37","productid":"4028b8815aa295ea015aa29934350004","name":"产品套餐2","createdatetime":1488801299101,"expdatetime":1491393299000,"num":1,"productitemlist":null,"total":0.01,"url":"http://oa91iwip0.bkt.clouddn.com/helloimg/product/20170306/20170306155209uQezbihr.png?imageMogr2/thumbnail/300x300"}]
         * outtradeno : 201703061954595
         * period : "180"
         * expiredatetime : null
         * userid : 37bc409ea2aa4f40956df25566e0eed2
         * type : product 套餐 enrol 报名 subject 公开课 group 班级课 recharge 充值 wdwraw 提现
         */

        private String id;
        private String studentid;
        private String status;
        private String statusname;
        private double amount;
        private long createdatetime;
        private String outtradeno;
        private String userid;
        private String period;//过期时间-秒
        private long expiredatetime;//过期日期
        private String type; //subject代表主题课 group代表小组课 可能还有其他套餐类型
        private List<OrderListBean> productList;
        private SubjectListResponse.SubjectBrief subject;
        private String allowrefundstatus;
        private OrderRefundsBean orderrefunds;
        private GroupBean group;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getStudentid() {
            return studentid;
        }

        public void setStudentid(String studentid) {
            this.studentid = studentid;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getStatusname() {
            return statusname;
        }

        public void setStatusname(String statusname) {
            this.statusname = statusname;
        }

        public double getAmount() {
            return amount;
        }

        public void setAmount(double amount) {
            this.amount = amount;
        }

        public long getCreatedatetime() {
            return createdatetime;
        }

        public void setCreatedatetime(long createdatetime) {
            this.createdatetime = createdatetime;
        }

        public String getOuttradeno() {
            return outtradeno;
        }

        public void setOuttradeno(String outtradeno) {
            this.outtradeno = outtradeno;
        }

        public String getUserid() {
            return userid;
        }

        public void setUserid(String userid) {
            this.userid = userid;
        }

        public List<OrderListBean> getProductList() {
            return productList;
        }

        public void setProductList(List<OrderListBean> productList) {
            this.productList = productList;
        }

        public String getPeriod() {
            return period;
        }

        public void setPeriod(String period) {
            this.period = period;
        }

        public long getExpiredatetime() {
            return expiredatetime;
        }

        public void setExpiredatetime(long expiredatetime) {
            this.expiredatetime = expiredatetime;
        }

        public SubjectListResponse.SubjectBrief getSubject() {
            return subject;
        }

        public void setSubject(SubjectListResponse.SubjectBrief subject) {
            this.subject = subject;
        }


        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getAllowrefundstatus() {
            return allowrefundstatus;
        }

        public void setAllowrefundstatus(String allowrefundstatus) {
            this.allowrefundstatus = allowrefundstatus;
        }


        public OrderRefundsBean getOrderrefunds() {
            return orderrefunds;
        }

        public void setOrderrefunds(OrderRefundsBean orderrefunds) {
            this.orderrefunds = orderrefunds;
        }

        public GroupBean getGroup() {
            return group;
        }

        public void setGroup(GroupBean group) {
            this.group = group;
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.studentid);
            dest.writeString(this.status);
            dest.writeString(this.statusname);
            dest.writeDouble(this.amount);
            dest.writeLong(this.createdatetime);
            dest.writeString(this.outtradeno);
            dest.writeString(this.userid);
            dest.writeString(this.period);
            dest.writeLong(this.expiredatetime);
            dest.writeString(this.type);
            dest.writeTypedList(this.productList);
            dest.writeParcelable(this.subject, flags);
            dest.writeString(this.allowrefundstatus);
            dest.writeParcelable(this.orderrefunds, flags);
            dest.writeParcelable(this.group, flags);
        }

        public OrderBean() {
        }

        protected OrderBean(Parcel in) {
            this.id = in.readString();
            this.studentid = in.readString();
            this.status = in.readString();
            this.statusname = in.readString();
            this.amount = in.readDouble();
            this.createdatetime = in.readLong();
            this.outtradeno = in.readString();
            this.userid = in.readString();
            this.period = in.readString();
            this.expiredatetime = in.readLong();
            this.type = in.readString();
            this.productList = in.createTypedArrayList(OrderListBean.CREATOR);
            this.subject = in.readParcelable(SubjectListResponse.SubjectBrief.class.getClassLoader());
            this.allowrefundstatus = in.readString();
            this.orderrefunds = in.readParcelable(OrderRefundsBean.class.getClassLoader());
            this.group = in.readParcelable(GroupBean.class.getClassLoader());
        }

        public static final Creator<OrderBean> CREATOR = new Creator<OrderBean>() {
            @Override
            public OrderBean createFromParcel(Parcel source) {
                return new OrderBean(source);
            }

            @Override
            public OrderBean[] newArray(int size) {
                return new OrderBean[size];
            }
        };
    }

    public static class OrderListBean implements Parcelable {
        /**
         * id : 9739c8364e7240f38047d9f002b27e37
         * productid : 4028b8815aa295ea015aa29934350004
         * name : 产品套餐2
         * createdatetime : 1488801299101
         * expdatetime : 1491393299000
         * num : 1
         * productitemlist : null
         * total : 0.01
         * url : http://oa91iwip0.bkt.clouddn.com/helloimg/product/20170306/20170306155209uQezbihr.png?imageMogr2/thumbnail/300x300
         */

        private String id;
        private String productid;
        private String name;
        private long createdatetime;
        private long expdatetime;
        private int num;
        //            private Object productitemlist;
        private double total;
        private String url;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getProductid() {
            return productid;
        }

        public void setProductid(String productid) {
            this.productid = productid;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public long getCreatedatetime() {
            return createdatetime;
        }

        public void setCreatedatetime(long createdatetime) {
            this.createdatetime = createdatetime;
        }

        public long getExpdatetime() {
            return expdatetime;
        }

        public void setExpdatetime(long expdatetime) {
            this.expdatetime = expdatetime;
        }

        public int getNum() {
            return num;
        }

        public void setNum(int num) {
            this.num = num;
        }

//            public Object getProductitemlist() {
//                return productitemlist;
//            }
//
//            public void setProductitemlist(Object productitemlist) {
//                this.productitemlist = productitemlist;
//            }

        public double getTotal() {
            return total;
        }

        public void setTotal(double total) {
            this.total = total;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.productid);
            dest.writeString(this.name);
            dest.writeLong(this.createdatetime);
            dest.writeLong(this.expdatetime);
            dest.writeInt(this.num);
            dest.writeDouble(this.total);
            dest.writeString(this.url);
        }

        public OrderListBean() {
        }

        protected OrderListBean(Parcel in) {
            this.id = in.readString();
            this.productid = in.readString();
            this.name = in.readString();
            this.createdatetime = in.readLong();
            this.expdatetime = in.readLong();
            this.num = in.readInt();
            this.total = in.readDouble();
            this.url = in.readString();
        }

        public static final Parcelable.Creator<OrderListBean> CREATOR = new Parcelable.Creator<OrderListBean>() {
            @Override
            public OrderListBean createFromParcel(Parcel source) {
                return new OrderListBean(source);
            }

            @Override
            public OrderListBean[] newArray(int size) {
                return new OrderListBean[size];
            }
        };
    }

    public static class OrderRefundsBean implements Parcelable {

        /**
         * orderid : fbc2dd4d6cfd451ea024474eed290cc2
         * refundremark :
         * refundreason : 缺钱
         * amount : 0.0
         * createdatetime : 1531989704000
         * rejectreason :
         * userid : 5fe1899cf4a14f84b19bd8c69b06e00e
         */

        private String orderid;
        private String refundremark;
        private String refundreason;
        private float amount;
        private long createdatetime;
        private String rejectreason;
        private String userid;

        public String getOrderid() {
            return orderid;
        }

        public void setOrderid(String orderid) {
            this.orderid = orderid;
        }

        public String getRefundremark() {
            return refundremark;
        }

        public void setRefundremark(String refundremark) {
            this.refundremark = refundremark;
        }

        public String getRefundreason() {
            return refundreason;
        }

        public void setRefundreason(String refundreason) {
            this.refundreason = refundreason;
        }

        public float getAmount() {
            return amount;
        }

        public void setAmount(float amount) {
            this.amount = amount;
        }

        public long getCreatedatetime() {
            return createdatetime;
        }

        public void setCreatedatetime(long createdatetime) {
            this.createdatetime = createdatetime;
        }

        public String getRejectreason() {
            return rejectreason;
        }

        public void setRejectreason(String rejectreason) {
            this.rejectreason = rejectreason;
        }

        public String getUserid() {
            return userid;
        }

        public void setUserid(String userid) {
            this.userid = userid;
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.orderid);
            dest.writeString(this.refundremark);
            dest.writeString(this.refundreason);
            dest.writeFloat(this.amount);
            dest.writeLong(this.createdatetime);
            dest.writeString(this.rejectreason);
            dest.writeString(this.userid);
        }

        public OrderRefundsBean() {
        }

        protected OrderRefundsBean(Parcel in) {
            this.orderid = in.readString();
            this.refundremark = in.readString();
            this.refundreason = in.readString();
            this.amount = in.readFloat();
            this.createdatetime = in.readLong();
            this.rejectreason = in.readString();
            this.userid = in.readString();
        }

        public static final Creator<OrderRefundsBean> CREATOR = new Creator<OrderRefundsBean>() {
            @Override
            public OrderRefundsBean createFromParcel(Parcel source) {
                return new OrderRefundsBean(source);
            }

            @Override
            public OrderRefundsBean[] newArray(int size) {
                return new OrderRefundsBean[size];
            }
        };
    }

    public static class GroupBean implements Parcelable {

        /**
         * id : 230f102fc5f94ce28eccb0e5408b8fc6
         * name : 测试123
         * logo : null
         * membercount : 0
         * livestatus : null
         * rule : null
         * evaluatestatus : null
         * imgroupid : null
         * userlist : null
         * grouplist : null
         * type : null
         * introduction : null
         * number : null
         * sellcount : null
         * price : null
         * begindatetime : null
         * enddatetime : null
         * purchasestatus : false
         * expire : false
         * writestatus : false
         */

        private String id;
        private String name;
        private boolean purchasestatus;
        private boolean expire;
        private boolean writestatus;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public boolean isPurchasestatus() {
            return purchasestatus;
        }

        public void setPurchasestatus(boolean purchasestatus) {
            this.purchasestatus = purchasestatus;
        }

        public boolean isExpire() {
            return expire;
        }

        public void setExpire(boolean expire) {
            this.expire = expire;
        }

        public boolean isWritestatus() {
            return writestatus;
        }

        public void setWritestatus(boolean writestatus) {
            this.writestatus = writestatus;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.name);
            dest.writeByte(this.purchasestatus ? (byte) 1 : (byte) 0);
            dest.writeByte(this.expire ? (byte) 1 : (byte) 0);
            dest.writeByte(this.writestatus ? (byte) 1 : (byte) 0);
        }

        public GroupBean() {
        }

        protected GroupBean(Parcel in) {
            this.id = in.readString();
            this.name = in.readString();
            this.purchasestatus = in.readByte() != 0;
            this.expire = in.readByte() != 0;
            this.writestatus = in.readByte() != 0;
        }

        public static final Parcelable.Creator<GroupBean> CREATOR = new Parcelable.Creator<GroupBean>() {
            @Override
            public GroupBean createFromParcel(Parcel source) {
                return new GroupBean(source);
            }

            @Override
            public GroupBean[] newArray(int size) {
                return new GroupBean[size];
            }
        };
    }

}